package com.BMS.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

/**
 * 违规记录实体类
 * @author lenovo
 *
 */
@Entity
@Table(name = "violate")
public class Violation {

	private int violation_ID;  // 违规记录ID
	
	private String type;  // 违规类型
	
	private String reader_ID;  // 违规读者ID
	
	private String manager_ID;  // 登记管理员ID
	
	private String book_ID;  // 图书ID
	
	@JSONField(format="yyyy-MM-dd")
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date reg_date;  // 登记日期
	
	@org.hibernate.annotations.Type(type="true_false")
	private boolean status;  // 处理状态

	public Violation() {
		
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "violation_ID",unique=true,nullable=false,length=12)
	public int getViolation_ID() {
		return violation_ID;
	}

	public void setViolation_ID(int violation_ID) {
		this.violation_ID = violation_ID;
	}

	@Column(name ="type",nullable=false,length=10)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "reader_ID",nullable=false,length=12)
	public String getReader_ID() {
		return reader_ID;
	}

	public void setReader_ID(String reader_ID) {
		this.reader_ID = reader_ID;
	}

	@Column(name = "manager_ID",nullable=false,length=12)
	public String getManager_ID() {
		return manager_ID;
	}

	public void setManager_ID(String manager_ID) {
		this.manager_ID = manager_ID;
	}

	@Column(name = "book_ID",nullable=false,length=12)
	public String getBook_ID() {
		return book_ID;
	}

	public void setBook_ID(String book_ID) {
		this.book_ID = book_ID;
	}
	@Column(name = "reg_date",nullable=false)
	public Date getReg_date() {
		return reg_date;
	}

	public void setReg_date(Date reg_date) {
		this.reg_date = reg_date;
	}

	@Column(name = "status",nullable=false,length=1)
	public boolean getStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}
	
	@Override
	public String toString() {
		JSONObject obj = new JSONObject();
		return obj.toJSONString(this);
	}
}
